package com.fxpc.hddc.fxqhpriority.jpa.dao.pg;


import com.fxpc.hddc.fxqhpriority.dto.pg.entity.FxqhPriorityBfEntity;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.time.LocalDate;
import java.util.List;

@Repository
public interface FxqhPriorityPgBaseDao extends JpaRepository<FxqhPriorityBfEntity, String> {

    @Query(nativeQuery = true, value = "select * from fxqh_priority WHERE CAST(create_time AS  DATE)= DATE(:nowDay) AND is_valid='1'")
    List<FxqhPriorityBfEntity> findPgOneDayDataByCreateTime(@Param(value = "nowDay") LocalDate nowDay);

    @Query(nativeQuery = true, value = "select * from fxqh_priority WHERE  is_valid='1'")
    List<FxqhPriorityBfEntity> findAllTime();

    Long count(Specification<FxqhPriorityBfEntity> specification);
}

